﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Common.Reflection.DAL.InterFace
{
    public interface DBInterFace
    {
        /// <summary>
        /// 查询返回表里的所有记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        List<object> GetList(object obj);



        /// <summary>
        /// 分页返回表里的所有记录
        /// </summary>
        /// <typeparam name="T">对象类型</typeparam>
        /// <param name="PageSize">每页信息量</param>
        /// <param name="NowPage">当前页</param>
        /// <returns></returns>
        List<object> GetListByPage(int PageSize, int NowPage, out int PageCount, out int recordCount, object obj);


        /// <summary>
        /// 分页模糊查询
        /// </summary>
        /// <typeparam name="T">对象类型</typeparam>
        /// <param name="PageSize">每页信息量</param>
        /// <param name="NowPage">当前页</param>
        /// <returns></returns>
        List<object> GetListByPageLikeKey(int PageSize, int NowPage, object obj, out int PageCount, out int recordCount);

        /// <summary>
        /// 按条件分页返回表里的所有记录
        /// </summary>
        /// <typeparam name="T">对象类型</typeparam>
        /// <param name="PageSize">每页信息量</param>
        /// <param name="NowPage">当前页</param>
        /// <returns></returns>
        List<object> GetListByPageAndKeys(int PageSize, int NowPage, object obj, out int PageCount, out int recordCount);


        /// <summary>
        /// 查询按某条件查询的所有记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        List<object> GetAllByKey(string key, string value, object obj);


        /// <summary>
        /// 查询满足条件的记录是否唯一存在
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        bool IsExist(object obj);

        /// <summary>
        /// 查询满足条件的记录是否存在
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        bool IsJustExist(object obj);

        /// <summary>
        /// 查询所有满足某些条件的数据
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        List<object> GetSomeObject(object obj);



        /// <summary>
        /// 查询按某条件查询的头几条记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        List<object> GetTopList(int count, object obj);


        /// <summary>
        /// 查询一条数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        object GetModel(object obj);


        /// <summary>
        /// 保存oracle(ID无自动增长)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        int Insert(object obj);


        /// <summary>
        /// 编辑一个对象并保存
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="nameSpace"></param>
        void Edit(object obj);

        /// <summary>
        /// 删除一条记录
        /// </summary>
        /// <param name="obj">对象</param>
        void Delete(object obj);

        /// <summary>
        /// 删除表里的所有内容
        /// </summary>
        /// <param name="obj"></param>
        void DeleteAll(object obj);


        /// <summary>
        /// 删除表里的几条数据（事务）
        /// </summary>
        /// <param name="obj"></param>
        void DeleteSome(object[] obj);


        /// <summary>
        /// 按照数据的某个字段的值删除记录
        /// </summary>
        /// <param name="obj">对象</param>
        void DeleteColumByKey_Value(object obj);

    }
}
